<admintpl file="header" />
<body class="J_scroll_fixed">
<div class="wrap J_check_wrap">
  <ul class="nav nav-tabs">
     <li><a href="{:U('AdminPost/index')}">所有景点</a></li>
     <li><a href="{:U('AdminPost/add')}"  target="_self">添加景点</a></li>
     <li class="active"><a href="javascript:;">景点趋势</a></li>
  </ul>
  <div id="main" style="height:400px"></div>
  <script src="http://echarts.baidu.com/build/dist/echarts.js"></script>
  <script type="text/javascript">
        // 路径配置
        require.config({
            paths: {
                echarts: 'http://echarts.baidu.com/build/dist'
            }
        });
        
        // 使用
        require(
            [
                'echarts',
                'echarts/chart/bar',
                'echarts/chart/line',
            ],
            function (ec) {
                // 基于准备好的dom，初始化echarts图表
                var myChart = ec.init(document.getElementById('main')); 
                
                
                var option = {
                  title : {
                      text: '景区热度趋势-{$title}',
                  },
                  tooltip : {
                      trigger: 'axis'
                  },
                  legend: {
                      data:['点击数','播放时长']
                  },
                  toolbox: {
                      show : true,
                      feature : {
                          //mark : {show: true},
                          dataView : {show: true, readOnly: false},
                          magicType : {show: true, type: ['line', 'bar']},
                          restore : {show: true},
                          saveAsImage : {show: true}
                      }
                  },
                  calculable : true,
                  dataZoom : {
                          show : true,
                          realtime : true,
                          start : 0,
                          end : 100
                  },
                  xAxis : [
                      {
                          name : '日期',
                          type : 'category',
                          boundaryGap : false,
                          data : {\$date},
                      }
                  ],
                  yAxis : [
                      {
                          type : 'value',
                          name : '点击数/次',
                          axisLabel : {
                              formatter: '{value}'
                          }
                      },
                      {
                          type : 'value',
                          name : '播放时长/秒',
                          axisLabel : {
                              formatter: '{value}'
                          }
                      }
                  ],
                  series : [
                      {
                          name:'点击数',
                          type:'line',
                          data:{\$hit},
                          markPoint : {
                              data : [
                                  {type : 'max', name: '最大值'},
                                  {type : 'min', name: '最小值'}
                              ]
                          },
                          markLine : {
                              data : [
                                  {type : 'average', name: '平均值'}
                              ]
                          }
                      },
                      {
                          name:'播放时长',
                          type:'line',
                          data:{\$timeval},
                          yAxisIndex:1,
                          markPoint : {
                              data : [
                                  {type : 'max', name: '最大值'},
                                  {type : 'min', name: '最小值'}
                              ]
                          },
                          markLine : {
                              data : [
                                  {type : 'average', name : '平均值'}
                              ]
                          }
                      }
                  ]
                };
                // 为echarts对象加载数据 
                myChart.setOption(option); 
            }
        );
  </script>

</div>
<script src="__ROOT__/statics/js/common.js"></script>
<script>

function refersh_window() {
    var refersh_time = getCookie('refersh_time');
    if (refersh_time == 1) {
        window.location="{:u('AdminPost/index',$formget)}";
    }
}
setInterval(function(){
	refersh_window();
}, 2000);


</script>
</body>
</html>